List of Non-Diagnostic Code Actions

Code actions for quick refactorings are listed below. These actions do not fix any problem, they let you to simplify the code. Optionally, these code actions can be configured to be applied automatically on save, or you can change their severity so they will appear as errors or warnings instead of just hints.

Configuration

  • Setting "php.problems.exclude": pair of { path, [array of problems ßand actions] } that will be hidden.
  • Setting "editor.codeActionsOnSave": { "source.fixAll": "explicit" }: lets you to enable auto-fix. When code actions are marked as auto-fix, they will be applied as auto-fix.
  • File .editorconfig: allows to change severity of code actions, suppress them, or mark them as auto-fix.

List

  • php_add_const_type:
  • php_extract_function:
  • php_remove_parentheses:
  • php_remove_redundant_closing_tag: If there is only PHP code in the file, the closing tag should be omitted. Otherwise the whitespace after the tag may be unintentionally rendered to the output. This is required for example in PER code style.
  • php_remove_unused_uses:
  • php_replace_with_class_pseudo_const:
  • php_replace_with_conditional_expression:
  • php_replace_with_const:
  • php_replace_with_json_validate:
  • php_replace_with_strict_null_equal:
  • php_replace_with_switch:
  • php_short_array_syntax: Use the new and simpler array syntax.
  • php_simplify_with_compound_assign:
  • php_simplify_with_inc_dec:
  • php_simplify_with_null_coalescing_operator:
  • php_simplify_with_null_safe:
  • php_simplify_with_short_ternary_operator:
  • php_sort_and_remove_unused_uses:
  • php_sort_uses:
  • php_switch_to_match:
  • php_to_string_cast:
  • php_to_string_interpolation: